package com.xiaolin.dao;

import com.xiaolin.pojo.AddFriends;
import org.apache.ibatis.annotations.*;
import tk.mybatis.mapper.common.Mapper;

import java.util.List;

/**
 * @author XiaoLin
 * @date 2019/2/26 11:17
 */
@org.apache.ibatis.annotations.Mapper
public interface AddFriendsMapper extends Mapper<AddFriends> {

    @Select("select * from add_friends where receive_uid = #{userId} and state = 1")
    @Results({
            @Result(property = "addfId", column = "addf_id"),
            @Result(property = "receiveUid", column = "receive_uid"),
            @Result(property = "addUid", column = "add_uid"),
            @Result(property = "addUser", one = @One(select = "com.xiaolin.dao.UserMapper.selectFriendById"), column = "add_uid"),
            @Result(property = "state", column = "state"),
            @Result(property = "applyDate", column = "apply_date"),
            @Result(property = "gid", column = "gid"),
    })
    List<AddFriends> findMyInfo(@Param("userId") String userId);
}
